/*
 * Hus_Button.h
 *
 *  Created on: 2020.7.16
 *      Author: HpDadi
 */

#ifndef HUS_UART_RX_H_
#define HUS_UART_RX_H_

/*
 * change stm32f1xx.h when your chip is stm32f1xx
 */
#include "stm32f4xx.h"
//#include "stm32f1xx.h"
/*
 * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 */
 
#include "cmsis_os.h"


//the Hus_Flag_State may be defined in other .h files, which shows the Flag is true or flase.
#ifndef __Hus_Flag_State
#define __Hus_Flag_State

typedef enum
{
	Hus_Flag_Flase = 0,
	Hus_Flag_True
}Hus_Flag_State;

#endif

#ifndef __Hus_State
#define __Hus_State

typedef enum
{
	Hus_State_Flase = 0,
	Hus_State_True
}Hus_State;

#endif

typedef struct
{
  UART_HandleTypeDef *huart;
  uint8_t *pBuffer;
  uint16_t Size;
  uint16_t pReaderOffset;
}Hus_Uart_Rx_DMABufferStruct;

typedef struct
{
  Hus_Uart_Rx_DMABufferStruct* husUartRxDMABufferStruct;
  uint8_t* pData;
  uint16_t dataSize;
  uint8_t* pIm;
  uint16_t imSize;
  char starter;
  char ender;
  uint8_t DelayTime;
}Hus_Uart_Rx_DMAextrImStruct;


void Hus_Uart_Rx_DMABufferStart(Hus_Uart_Rx_DMABufferStruct* husUartRxDMABufferStruct);
uint16_t Hus_Uart_Rx_DMABufferRead(Hus_Uart_Rx_DMABufferStruct* husUartRxDMABufferStruct,uint8_t* pData,uint16_t dataSize);
void Hus_Uart_Rx_DMAextrImTask(void* pvParameters);
  
#endif
